package com.test.mchelepesa.activity_fragment_rice.base_rice;

import android.os.Bundle;

import androidx.annotation.Nullable;

import com.test.mchelepesa.bean_rice.config_info_rice.GlobalConfig_rice;
import com.test.mchelepesa.bean_rice.user_info_rice.LoginInfo_rice;
import com.test.mchelepesa.util_rice.StringUtil_rice;
import com.test.mchelepesa.util_rice.helper_rice.UserInfoHelper_rice;
import com.test.mchelepesa.util_rice.http_rice.HttpManager_rice;
import com.test.mchelepesa.util_rice.analytics_rice.event_rice.IAnalyticsEvent_rice;
import com.test.mchelepesa.util_rice.analytics_rice.util_rice.AnalyticsUtil_rice;


public abstract class BaseLoginActivity_rice extends BaseActivity_rice {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    //登录成功响应
    public void onUserLoginResponse_rice() {
        try {
            //String phoneNum = UserInfoHelper.getInstance().getMobile();
            //打点
            String gtype = LoginInfo_rice.getInstance().getType();
            if (gtype.equalsIgnoreCase(UserInfoHelper_rice.LOGIN_TYPE_REGISTER_rice)) {
                AnalyticsUtil_rice.INSTANCE.addEvent(IAnalyticsEvent_rice.AT_REGISTER);
            }

            //保存登录信息到本地
            UserInfoHelper_rice.getInstance().setToken_rice(LoginInfo_rice.getInstance().getToken());
            UserInfoHelper_rice.getInstance().setUserId_rice(LoginInfo_rice.getInstance().getUserId());
            //UserInfoHelper.getInstance().setMobile(phoneNum);

            //登录前初始化
            AnalyticsUtil_rice.INSTANCE.initDevice(BaseApplication_rice.gApplication_rice());
            AnalyticsUtil_rice.INSTANCE.saveFirebaseS2SInfo(GlobalConfig_rice.getInstance().getCountryFullPaths());

            //请求用户流程信息
            HttpManager_rice.getInstance().requestUserProcess();

        } catch (Exception e) {
            StringUtil_rice.printException(e);
        }
    }

}